Skip to content

refactor(ast): re-order layout assertions in memory order#20583

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/02-15-refactor_ast_re-order_layout_assertions_in_memory_order
Mar 20, 2026
Merged

refactor(ast): re-order layout assertions in memory order#20583
graphite-app[bot] merged 1 commit intomainfrom
om/02-15-refactor_ast_re-order_layout_assertions_in_memory_order

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Mar 20, 2026

Refactor. Generate assertions for type sizes in the order which they are in memory. This makes it easier to see how these types are laid out in memory.

Copy link
Copy Markdown
Member Author

overlookmotel commented Mar 20, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 20, 2026

Merging this PR will not alter performance

✅ 53 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/02-15-refactor_ast_re-order_layout_assertions_in_memory_order (cc4867c) with main (d176ecc)2

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on om/02-15-refactor_ast_tools_convert_layout_calculation_to_a_struct_with_methods (9d78591) during the generation of this report, so main (d176ecc) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel marked this pull request as ready for review March 20, 2026 21:22
Copilot AI review requested due to automatic review settings March 20, 2026 21:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the AST layout-assertion generator to emit struct field offset_of! assertions in ascending memory-offset order, making the generated layout files easier to read and reason about.

Changes:

  • Sort struct fields by computed offset before generating offset_of! assertions.
  • Update generator internals to pass the sorted field list through the assertion-generation path.
  • Regenerate assert_layouts.rs outputs across affected crates with the reordered assertions.

Reviewed changes

Copilot reviewed 1 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tasks/ast_tools/src/generators/assert_layouts.rs Sorts fields by offset (stable) before emitting offset assertions.
napi/parser/src/generated/assert_layouts.rs Regenerated layout assertions with offsets ordered by memory layout.
crates/oxc_syntax/src/generated/assert_layouts.rs Regenerated layout assertions with offsets ordered by memory layout.
crates/oxc_regular_expression/src/generated/assert_layouts.rs Regenerated layout assertions with offsets ordered by memory layout.
crates/oxc_linter/src/generated/assert_layouts.rs Regenerated layout assertions with offsets ordered by memory layout.
crates/oxc_ast/src/generated/assert_layouts.rs Regenerated layout assertions with offsets ordered by memory layout.
crates/oxc_allocator/src/generated/assert_layouts.rs Regenerated layout assertions with offsets ordered by memory layout.

@overlookmotel overlookmotel self-assigned this Mar 20, 2026
@overlookmotel overlookmotel force-pushed the om/02-15-refactor_ast_re-order_layout_assertions_in_memory_order branch from 2dfbe32 to cc4867c Compare March 20, 2026 22:02
@overlookmotel overlookmotel force-pushed the om/02-15-refactor_ast_tools_convert_layout_calculation_to_a_struct_with_methods branch from 940fab3 to 9d78591 Compare March 20, 2026 22:02
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Mar 20, 2026
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Mar 20, 2026

Merge activity

Refactor. Generate assertions for type sizes in the order which they are in memory. This makes it easier to see how these types are laid out in memory.
@graphite-app graphite-app bot force-pushed the om/02-15-refactor_ast_tools_convert_layout_calculation_to_a_struct_with_methods branch from 9d78591 to d5b9738 Compare March 20, 2026 22:18
@graphite-app graphite-app bot force-pushed the om/02-15-refactor_ast_re-order_layout_assertions_in_memory_order branch from cc4867c to e984666 Compare March 20, 2026 22:19
@graphite-app graphite-app bot removed 0-merge Merge with Graphite Merge Queue labels Mar 20, 2026
Base automatically changed from om/02-15-refactor_ast_tools_convert_layout_calculation_to_a_struct_with_methods to main March 20, 2026 22:27
@graphite-app graphite-app bot merged commit e984666 into main Mar 20, 2026
27 checks passed
@graphite-app graphite-app bot deleted the om/02-15-refactor_ast_re-order_layout_assertions_in_memory_order branch March 20, 2026 22:28
costajohnt pushed a commit to costajohnt/oxc that referenced this pull request Mar 22, 2026
…t#20583)

Refactor. Generate assertions for type sizes in the order which they are in memory. This makes it easier to see how these types are laid out in memory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-ast-tools Area - AST tools A-linter Area - Linter A-parser Area - Parser C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants